package com.boot.dataInterceptor;

import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.context.ApplicationContext;

import java.lang.reflect.Method;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

/**
 * @BelongsProject: springboot
 * @BelongsPackage: com.boot.dataInterceptor
 * @Author: meikaiqiang
 * @CreateTime: 2022-08-09  09:28
 * @Description: TODO
 * @Version: 1.0
 */
@Slf4j
public class DataInterceptorImpl implements DataInterceptor {
    private static ApplicationContext context;
    private final String a;
    private final ConcurrentMap<String, DataScop> dataAuthMap = new ConcurrentHashMap(8);

    public void intercept(Executor executor, MappedStatement ms, Object parameter, RowBounds rowBounds, ResultHandler resultHandler, BoundSql boundSql) {

        System.out.println("asdad");
    }

    private DataScop findDataAuthAnnotation(MappedStatement mappedStatement) {
        System.out.println("asdasdasd");
        Class<DataScop> ds = DataScop.class;
        dataAuthMap.forEach((k,v) ->{
            System.out.println(v);
        });
        return (DataScop) ds.getAnnotation(DataScop.class);
    }

    public DataInterceptorImpl(String a, String b){
        System.out.println(b+"***********");
        this.a = a;
    }
}
